<?php
/**
 * User: lie
 * Date: 2020-11-07 19:39
 * description: 批量删除
 */
    echo "<form action='' method='POST'>";
        echo "请输入要删除的客户编码：<input type='text' name='text'>";
        echo "<input type='submit' value='删除' name='sub'>";
    echo "</form>";
    if ($_POST['sub']){
        $mysqli = new mysqli('localhost', 'root', 'root', 'php1200');
        $sql = "SELECT * FROM customer";
        $result = $mysqli->query($sql);
        $text = $_POST['text'];
        $b = 0;
        $obj = $result->fetch_object();
        $delsql = "DELETE FROM customer WHERE cCusCode='$text'";
        $mysqli->query($delsql);
        if ($text == $obj->cCusCode){
            echo "客户编码为: ".$obj->cCusCode.", 名称: ".$obj->cCusName." 简称为: ".$obj->cCusAddName."已删除";
        } else {
            echo "没有该客户";
        }
}

